Skip to content

Parsing SWA EasyAuth token and Cosmos Auth#537

Merged
tarazou9 merged 12 commits into
mainfrom
users/tarazou/SWAAuth
Jul 12, 2022
Merged

Parsing SWA EasyAuth token and Cosmos Auth#537
tarazou9 merged 12 commits into
mainfrom
users/tarazou/SWAAuth

Conversation

@tarazou9

@tarazou9 tarazou9 commented Jul 5, 2022

Copy link
Copy Markdown
Contributor

Why This Change

  • Currently the EasyAuth Token parsing is taken the payload format from AppService. The StaticWebApps has a different token payload format. So this change is for parsing SWA EasyAuth token.
  • Currently the authorization is not applying to Cosmos, this change is for Cosmos to adopt authorization.

What changes were made

  • Updated EasyAuth provider to have "StaticWebApps" and "AppService", and depends on the config settings, it will use different handler for token parsing.
  • Updated CosmosSqlMetadataProvider to work with authorization.

How was it tested?

  • Added unit tests for SWA EasyAuth token parsing.
  • Make sure unit tests for AppService EasyAuth token parsing still passes.
  • Tested with real SWA EasyAuth at runtime.

@seantleonard seantleonard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciate your efforts to bring the SWA EasyAuth token format support to the engine! A few questions/nits and otherwise looks good

Comment thread DataGateway.Service/hawaii-config.Cosmos.overrides.example.json Outdated
Comment thread DataGateway.Config/Authentication.cs
Comment thread DataGateway.Service/Services/MetadataProviders/CosmosSqlMetadataProvider.cs Outdated
Comment thread DataGateway.Service/Services/MetadataProviders/CosmosSqlMetadataProvider.cs Outdated
Comment thread DataGateway.Service/Services/MetadataProviders/CosmosSqlMetadataProvider.cs Outdated
@tarazou9 tarazou9 force-pushed the users/tarazou/SWAAuth branch from 2d23f57 to f626ab2 Compare July 5, 2022 19:59
@tarazou9 tarazou9 force-pushed the users/tarazou/SWAAuth branch from 728cce4 to 2a506e9 Compare July 5, 2022 20:30
Comment thread DataGateway.Service/hawaii-config.Cosmos.json
Comment thread DataGateway.Service/hawaii-config.json Outdated
Comment thread DataGateway.Config/Authentication.cs Outdated
Comment thread DataGateway.Service/hawaii-config.json
Comment thread DataGateway.Service/Services/MetadataProviders/CosmosSqlMetadataProvider.cs Outdated
Comment thread DataGateway.Service/Services/MetadataProviders/CosmosSqlMetadataProvider.cs Outdated
Comment thread DataGateway.Service/Services/MetadataProviders/CosmosSqlMetadataProvider.cs Outdated
Comment thread DataGateway.Service/AuthenticationHelpers/AppServiceAuthenticationHandler.cs Outdated
Comment thread DataGateway.Service/AuthenticationHelpers/AppServiceAuthentication.cs Outdated
Comment thread DataGateway.Service/AuthenticationHelpers/StaticWebAppsAuthenticationHandler.cs Outdated
Comment thread DataGateway.Service/AuthenticationHelpers/StaticWebAppsAuthenticationHandler.cs Outdated
Comment thread DataGateway.Service/Services/MetadataProviders/CosmosSqlMetadataProvider.cs Outdated

@Aniruddh25 Aniruddh25 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting on removing code duplication...

Comment thread DataGateway.Config/Authentication.cs Outdated
Comment thread DataGateway.Config/Authentication.cs Outdated
Comment thread DataGateway.Service/AuthenticationHelpers/EasyAuthAuthenticationHandler.cs Outdated
Comment thread DataGateway.Service/Startup.cs
Comment thread DataGateway.Service/AuthenticationHelpers/EasyAuthAuthenticationHandler.cs Outdated

@Aniruddh25 Aniruddh25 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for fixing this important token parsing issue :)

@tarazou9 tarazou9 enabled auto-merge (squash) July 12, 2022 14:22
@tarazou9 tarazou9 merged commit 80e68c3 into main Jul 12, 2022
@tarazou9 tarazou9 deleted the users/tarazou/SWAAuth branch July 12, 2022 14:29
seantleonard pushed a commit that referenced this pull request Jul 13, 2022
Parsing SWA EasyAuth token and Cosmos Auth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Every request throws NotSupportedException when using Cosmos due to Updated Auth Logic

6 participants